﻿using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ym.Core.Communi
{
    public class SerialPortParameter
    {
        public SerialPortParameter()
            : this("COM3", 9600, Parity.None, 8, StopBits.One)
        {
        }

        public SerialPortParameter(string portName, int baudRate, Parity parity, int dataBits, StopBits stopBits)
        {
            this.PortName = portName;
            this.BaudRate = baudRate;
            this.Parity = parity;
            this.DataBits = dataBits;
            this.StopBits = stopBits;
        }

        /// <summary>
        /// 串口号
        /// </summary>
        public string PortName { get; private set; }

        /// <summary>
        /// 波特率
        /// </summary>
        public int BaudRate { get; private set; }

        /// <summary>
        /// 奇偶校验位
        /// </summary>
        public Parity Parity { get; private set; }

        /// <summary>
        /// 数据位
        /// </summary>
        public int DataBits { get; private set; }

        /// <summary>
        /// 停止位
        /// </summary>
        public StopBits StopBits { get; private set; }

    }
}
